<template>
  <view class="container">
    <router-view />
  </view>
</template>

<script>
import { isLoggedIn } from './utils/auth'

export default {
  onLaunch: function() {
    // 初始化应用
    console.log('应用启动')
    
    // 获取系统信息
    const systemInfo = uni.getSystemInfoSync()
    this.globalData.systemInfo = systemInfo
    
    // 检查登录状态但不强制跳转
    const isLogin = isLoggedIn()
    console.log('当前登录状态:', isLogin)
  },
  onShow: function() {
  },
  onHide: function() {
  },
  globalData: {
    systemInfo: null
  },
  methods: {
    // 全局方法
    showLoading(title = '加载中') {
      uni.showLoading({
        title,
        mask: true
      })
    },
    hideLoading() {
      uni.hideLoading()
    },
    showToast(title, icon = 'none') {
      uni.showToast({
        title,
        icon,
        duration: 2000
      })
    }
  }
}
</script>

<style>
@import '/src/assets/styles/reset.css';
@import '/src/assets/styles/common.css';

.container {
  height: 100vh;
  background-color: #f8f8f8;
}

page {
  background-color: #f8f8f8;
  height: 100%;
  font-size: 28rpx;
  color: #333;
}

/* 全局通用样式 */
.flex {
  display: flex;
}

.flex-column {
  display: flex;
  flex-direction: column;
}

.justify-between {
  justify-content: space-between;
}

.align-center {
  align-items: center;
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.text-primary {
  color: #ff0000;
}

.text-gray {
  color: #999;
}

.font-bold {
  font-weight: bold;
}

.mt-10 {
  margin-top: 10rpx;
}

.mb-10 {
  margin-bottom: 10rpx;
}

.ml-10 {
  margin-left: 10rpx;
}

.mr-10 {
  margin-right: 10rpx;
}

.p-20 {
  padding: 20rpx;
}
</style>
